package bavaria.hightech.banking.gui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;

/**
 * ActionListener for the "ViewBalance" command from the Menu. Loads the
 * balanceView JPanel into the contentWrapper Panel.
 * 
 * @author Dietmar
 */
public class ListenerViewBalance implements ActionListener {

	private JPanel contentWrapper;
	private GlobalVarsContainer cont;

	public ListenerViewBalance(GlobalVarsContainer cont) {
		this.cont = cont;
		this.contentWrapper = cont.getContentWrapper();
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		PanelBalance balanceView = new PanelBalance(cont);
		JPanel balanceViewJPanel = balanceView.getJPanel();
		contentWrapper.removeAll();
		contentWrapper.add(balanceViewJPanel, BorderLayout.CENTER);
		contentWrapper.validate();
	}

}
